<?php
/*
 * Template Name:博文列表
 * 
 */
get_header(); ?>

<div class="page_width">
	<div class="pagebox">
	    <div class="article_left">
	        <ul>
	          <?php
	            $page_data = get_page($page_id);
	            query_posts('&ignore_sticky_posts=1&paged='.$paged.'&meta_key=article_type&meta_value='.$page_data->post_title);
	            $postnun=1;
	            if(have_posts()):while(have_posts()):the_post();
	          ?>
	          <li class="articlelist">
	            <div class="thumbnail">
	              <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" target="_blank">
	                <?php
	                  $picurl = get_post_meta($post->ID,'haikuo_pic_url',true);
	                  if( has_post_thumbnail() ){
	                    $img_id = get_post_thumbnail_id();
	                    $img_url = wp_get_attachment_image_src($img_id);
	                    $img_url = $img_url[0];
	                    $img_url_full = $img_url.'_full.jpg';
	                    $array1 = get_headers($img_url_full);
	                    if ($array1[0] == 'HTTP/1.1 200 OK') { }
	                    else{
	                      $img_url = get_bloginfo("template_url").'/timthumb.php?src='.$img_url.'&amp;q=90&amp;w=100&amp;h=140';
	                    }
	                  }elseif(!empty($picurl)){
	                    $img_url = get_bloginfo("template_url").'/timthumb.php?src='.$picurl.'&amp;q=90&amp;w=100&amp;h=140';
	                  }else{
	                    $img_url = get_post_img( '', 100, '' );
	                  }
	                  echo '<img src="'.$img_url.'" alt="'.$post->post_title.'" width="100" height="140" />'
	                  ?>
	              </a>
	            </div>
	            <div class="title">
	              <h1>
	                <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" target="_blank"><?php the_title(); ?>
	                </a>
	              </h1>
	              <?php if(is_sticky()){ ?>
	              <span>推荐</span>
	              <?php } ?>
	            </div>
	            <div class="info">
	            	<div style="display:inline-block">
		              <!--<div class="category"><?php the_category('') ?></div>
		              <div class="author"><?php the_author_posts_link(); ?></div>-->
		              <div class="date">
		                <?php the_time('Y-m-d') ?>
		              </div>
		              <div class="view">
		                <?php echo getPostViews(get_the_ID()); ?>
		              </div>
		              <div class="comment">
		                <?php comments_number('0','1','%');?>
		              </div>
	            	</div>
	            </div>
	            <div class="summary">
	              <?php the_excerpt(); ?>
	            </div>
	            <!--<div class="tag"><?php the_tags('','',''); ?></div>-->
	          </li>
	          <?php $postnun++; endwhile; else: ?>
	          <li class="articlelist">
	            <div class="nothing">抱歉，暂无相关内容！</div>
	          </li>
	          <?php endif; ?>
	        </ul>
	        <div class="page">
	        	<?php posts_pagenavi(); ?>
	        </div>
	    </div>
	    <?php get_sidebar(); ?>
	</div>
</div>
<?php get_footer(); ?>